<!DOCTYPE html><html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;">
<meta charset="utf-8">
<title>ArangoDB PHP client API » \ArangoDBClient\Connection</title>
<meta name="author" content="Mike van Riel">
<meta name="description" content="">
<link href="../css/template.css" rel="stylesheet" media="all">
<script src="../js/jquery-1.7.1.min.js" type="text/javascript"></script><script src="../js/jquery-ui-1.8.2.custom.min.js" type="text/javascript"></script><script src="../js/jquery.mousewheel.min.js" type="text/javascript"></script><script src="../js/bootstrap.js" type="text/javascript"></script><script src="../js/template.js" type="text/javascript"></script><script src="../js/prettify/prettify.min.js" type="text/javascript"></script><link rel="shortcut icon" href="../img/favicon.ico">
<link rel="apple-touch-icon" href="../img/apple-touch-icon.png">
<link rel="apple-touch-icon" sizes="72x72" href="../img/apple-touch-icon-72x72.png">
<link rel="apple-touch-icon" sizes="114x114" href="../img/apple-touch-icon-114x114.png">
</head>
<body>
<div class="navbar navbar-fixed-top">
<div class="navbar-inner"><div class="container">
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse"><span class="icon-bar"></span><span class="icon-bar"></span><span class="icon-bar"></span></a><a class="brand" href="../index.html">ArangoDB PHP client API</a><div class="nav-collapse"><ul class="nav">
<li class="dropdown">
<a href="#api" class="dropdown-toggle" data-toggle="dropdown">
                                    API Documentation <b class="caret"></b></a><ul class="dropdown-menu">
<li><a>Packages</a></li>
<li><a href="../packages/ArangoDBClient.html"><i class="icon-folder-open"></i> ArangoDBClient</a></li>
</ul>
</li>
<li class="dropdown" id="charts-menu">
<a href="#charts" class="dropdown-toggle" data-toggle="dropdown">
                                    Charts <b class="caret"></b></a><ul class="dropdown-menu"><li><a href="../graph_class.html"><i class="icon-list-alt"></i> Class hierarchy diagram</a></li></ul>
</li>
<li class="dropdown" id="reports-menu">
<a href="#reports" class="dropdown-toggle" data-toggle="dropdown">
                                    Reports <b class="caret"></b></a><ul class="dropdown-menu">
<li><a href="../errors.html"><i class="icon-remove-sign"></i> Errors 
                <span class="label label-info">25</span></a></li>
<li><a href="../markers.html"><i class="icon-map-marker"></i> Markers 
                <ul></ul></a></li>
<li><a href="../deprecated.html"><i class="icon-stop"></i> Deprecated elements 
                <span class="label label-info">15</span></a></li>
</ul>
</li>
</ul></div>
</div></div>
<div class="go_to_top"><a href="#___" style="color: inherit">Back to top  <i class="icon-upload icon-white"></i></a></div>
</div>
<div id="___" class="container">
<noscript><div class="alert alert-warning">
                            Javascript is disabled; several features are only available
                            if Javascript is enabled.
                        </div></noscript>
<div class="row">
<div class="span4">
<div xmlns:php="http://php.net/xsl" class="btn-toolbar">
<div class="btn-group visibility" data-toggle="buttons-checkbox">
<button class="btn public active" title="Show public elements">Public</button><button class="btn protected" title="Show protected elements">Protected</button><button class="btn private" title="Show private elements">Private</button><button class="btn inherited active" title="Show inherited elements">Inherited</button>
</div>
<div class="btn-group view pull-right" data-toggle="buttons-radio">
<button class="btn details" title="Show descriptions and method names"><i class="icon-list"></i></button><button class="btn simple" title="Show only method names"><i class="icon-align-justify"></i></button>
</div>
</div>
<ul xmlns:php="http://php.net/xsl" class="side-nav nav nav-list">
<li class="nav-header">
<i title="Methods" class="icon-custom icon-method"></i> Methods
                    <ul>
<li class="method public "><a href="#method___construct" title="__construct() :: Set up the connection object, validate the options provided"><span class="description">Set up the connection object, validate the options provided</span><pre>__construct()</pre></a></li>
<li class="method public "><a href="#method___destruct" title="__destruct() :: Close existing connection handle if a keep-alive connection was used"><span class="description">Close existing connection handle if a keep-alive connection was used</span><pre>__destruct()</pre></a></li>
<li class="method public "><a href="#method_check_encoding" title="check_encoding() :: This function checks that the encoding of the keys and
values of the array are utf-8, recursively."><span class="description">This function checks that the encoding of the keys and
values of the array are utf-8, recursively.</span><pre>check_encoding()</pre></a></li>
<li class="method public "><a href="#method_delete" title="delete() :: Issue an HTTP DELETE request with the data provided"><span class="description">Issue an HTTP DELETE request with the data provided</span><pre>delete()</pre></a></li>
<li class="method public "><a href="#method_detect_utf" title="detect_utf() :: This function checks that the encoding of a string is utf."><span class="description">This function checks that the encoding of a string is utf.</span><pre>detect_utf()</pre></a></li>
<li class="method public "><a href="#method_get" title="get() :: Issue an HTTP GET request"><span class="description">Issue an HTTP GET request</span><pre>get()</pre></a></li>
<li class="method public "><a href="#method_getActiveBatch" title="getActiveBatch() :: returns the active batch"><span class="description">returns the active batch</span><pre>getActiveBatch()</pre></a></li>
<li class="method public "><a href="#method_getBatches" title="getBatches() :: returns the active batch"><span class="description">returns the active batch</span><pre>getBatches()</pre></a></li>
<li class="method public "><a href="#method_getCurrentEndpoint" title="getCurrentEndpoint() :: Returns the current endpoint we are currently connected to
(or, if no connection has been established yet, the next endpoint
that we will connect to)"><span class="description">Returns the current endpoint we are currently connected to
(or, if no connection has been established yet, the next endpoint
that we will connect to)</span><pre>getCurrentEndpoint()</pre></a></li>
<li class="method public "><a href="#method_getDatabase" title="getDatabase() :: Get the database to use with this connection, for example: 'my_database'"><span class="description">Get the database to use with this connection, for example: 'my_database'</span><pre>getDatabase()</pre></a></li>
<li class="method public "><a href="#method_getOption" title="getOption() :: Get an option set for the connection"><span class="description">Get an option set for the connection</span><pre>getOption()</pre></a></li>
<li class="method public "><a href="#method_getOptions" title="getOptions() :: Get the options set for the connection"><span class="description">Get the options set for the connection</span><pre>getOptions()</pre></a></li>
<li class="method public "><a href="#method_head" title="head() :: Issue an HTTP Head request with the data provided"><span class="description">Issue an HTTP Head request with the data provided</span><pre>head()</pre></a></li>
<li class="method public "><a href="#method_isInBatchCaptureMode" title="isInBatchCaptureMode() :: Returns true if this connection is in Batch-Capture mode"><span class="description">Returns true if this connection is in Batch-Capture mode</span><pre>isInBatchCaptureMode()</pre></a></li>
<li class="method public "><a href="#method_json_encode_wrapper" title="json_encode_wrapper() :: This is a json_encode() wrapper that also checks if the data is utf-8 conform."><span class="description">This is a json_encode() wrapper that also checks if the data is utf-8 conform.</span><pre>json_encode_wrapper()</pre></a></li>
<li class="method public "><a href="#method_parseResponse" title="parseResponse() :: Parse the response return the body values as an assoc array"><span class="description">Parse the response return the body values as an assoc array</span><pre>parseResponse()</pre></a></li>
<li class="method public "><a href="#method_patch" title="patch() :: Issue an HTTP PATCH request with the data provided"><span class="description">Issue an HTTP PATCH request with the data provided</span><pre>patch()</pre></a></li>
<li class="method public "><a href="#method_post" title="post() :: Issue an HTTP POST request with the data provided"><span class="description">Issue an HTTP POST request with the data provided</span><pre>post()</pre></a></li>
<li class="method public "><a href="#method_put" title="put() :: Issue an HTTP PUT request with the data provided"><span class="description">Issue an HTTP PUT request with the data provided</span><pre>put()</pre></a></li>
<li class="method public "><a href="#method_setActiveBatch" title="setActiveBatch() :: Sets the active Batch for this connection"><span class="description">Sets the active Batch for this connection</span><pre>setActiveBatch()</pre></a></li>
<li class="method public "><a href="#method_setBatchRequest" title="setBatchRequest() :: Sets connection into Batch-request mode. This is needed for some operations to act differently when in this mode."><span class="description">Sets connection into Batch-request mode. This is needed for some operations to act differently when in this mode.</span><pre>setBatchRequest()</pre></a></li>
<li class="method public "><a href="#method_setCaptureBatch" title="setCaptureBatch() :: Sets the batch capture state (true, if capturing)"><span class="description">Sets the batch capture state (true, if capturing)</span><pre>setCaptureBatch()</pre></a></li>
<li class="method public "><a href="#method_setDatabase" title="setDatabase() :: Set the database to use with this connection"><span class="description">Set the database to use with this connection</span><pre>setDatabase()</pre></a></li>
<li class="method public "><a href="#method_setOption" title="setOption() :: Set an option set for the connection"><span class="description">Set an option set for the connection</span><pre>setOption()</pre></a></li>
<li class="method public "><a href="#method_stopCaptureBatch" title="stopCaptureBatch() :: Stop capturing commands"><span class="description">Stop capturing commands</span><pre>stopCaptureBatch()</pre></a></li>
<li class="method public "><a href="#method_test" title="test() :: Test if a connection can be made using the specified connection options,
i.e. endpoint (host/port), username, password"><span class="description">Test if a connection can be made using the specified connection options,
i.e. endpoint (host/port), username, password</span><pre>test()</pre></a></li>
</ul>
</li>
<li class="nav-header private">» Private
                    <ul>
<li class="method private "><a href="#method_closeHandle" title="closeHandle() :: Close an existing connection handle"><span class="description">Close an existing connection handle</span><pre>closeHandle()</pre></a></li>
<li class="method private "><a href="#method_doBatch" title="doBatch() :: This is a helper function to executeRequest that captures requests if we're in batch mode"><span class="description">This is a helper function to executeRequest that captures requests if we're in batch mode</span><pre>doBatch()</pre></a></li>
<li class="method private "><a href="#method_executeRequest" title="executeRequest() :: Execute an HTTP request and return the results"><span class="description">Execute an HTTP request and return the results</span><pre>executeRequest()</pre></a></li>
<li class="method private "><a href="#method_getHandle" title="getHandle() :: Get a connection handle"><span class="description">Get a connection handle</span><pre>getHandle()</pre></a></li>
<li class="method private "><a href="#method_handleFailover" title="handleFailover() :: Execute the specified callback, and try again if it fails because
the target server is not available. In this case, try again with failing
over to an alternative server (the new leader) until the maximum number
of failover attempts have been made"><span class="description">Execute the specified callback, and try again if it fails because
the target server is not available. In this case, try again with failing
over to an alternative server (the new leader) until the maximum number
of failover attempts have been made</span><pre>handleFailover()</pre></a></li>
<li class="method private "><a href="#method_notify" title="notify() :: Calls the notification callback function to inform to make the
client application aware of some failure so it can do something
appropriate (e.g. logging)"><span class="description">Calls the notification callback function to inform to make the
client application aware of some failure so it can do something
appropriate (e.g. logging)</span><pre>notify()</pre></a></li>
<li class="method private "><a href="#method_updateHttpHeader" title="updateHttpHeader() :: Recalculate the static HTTP header string used for all HTTP requests in this connection"><span class="description">Recalculate the static HTTP header string used for all HTTP requests in this connection</span><pre>updateHttpHeader()</pre></a></li>
</ul>
</li>
<li class="nav-header">
<i title="Properties" class="icon-custom icon-property"></i> Properties
                    <ul></ul>
</li>
<li class="nav-header private">» Private
                    <ul>
<li class="property private "><a href="#property__activeBatch" title="$_activeBatch() :: $_activeBatch object"><span class="description"></span><pre>$_activeBatch</pre></a></li>
<li class="property private "><a href="#property__baseUrl" title="$_baseUrl() :: Pre-assembled base URL for the current database
This is pre-calculated when connection options are set/changed, to avoid
calculation of the same base URL in each request done via the
connection"><span class="description"></span><pre>$_baseUrl</pre></a></li>
<li class="property private "><a href="#property__batchRequest" title="$_batchRequest() :: $_batchRequest boolean"><span class="description"></span><pre>$_batchRequest</pre></a></li>
<li class="property private "><a href="#property__batches" title="$_batches() :: Batches Array"><span class="description"></span><pre>$_batches</pre></a></li>
<li class="property private "><a href="#property__captureBatch" title="$_captureBatch() :: $_captureBatch boolean"><span class="description"></span><pre>$_captureBatch</pre></a></li>
<li class="property private "><a href="#property__database" title="$_database() :: $_database string"><span class="description"></span><pre>$_database</pre></a></li>
<li class="property private "><a href="#property__handle" title="$_handle() :: Connection handle, used in case of keep-alive"><span class="description"></span><pre>$_handle</pre></a></li>
<li class="property private "><a href="#property__httpHeader" title="$_httpHeader() :: Pre-assembled HTTP headers string for connection
This is pre-calculated when connection options are set/changed, to avoid
calculation of the same HTTP header values in each request done via the
connection"><span class="description"></span><pre>$_httpHeader</pre></a></li>
<li class="property private "><a href="#property__options" title="$_options() :: Connection options"><span class="description"></span><pre>$_options</pre></a></li>
<li class="property private "><a href="#property__useKeepAlive" title="$_useKeepAlive() :: Flag if keep-alive connections are used"><span class="description"></span><pre>$_useKeepAlive</pre></a></li>
</ul>
</li>
</ul>
</div>
<div class="span8">
<a xmlns:php="http://php.net/xsl" id="\ArangoDBClient\Connection"></a><ul xmlns:php="http://php.net/xsl" class="breadcrumb">
<li>
<a href="../index.html"><i title="Classes" class="icon-custom icon-class"></i></a><span class="divider">\</span>
</li>
<li><a href="../namespaces/ArangoDBClient.html">ArangoDBClient</a></li>
<li class="active">
<span class="divider">\</span><a href="../classes/ArangoDBClient.Connection.html">Connection</a>
</li>
</ul>
<div xmlns:php="http://php.net/xsl" class="element class">
<p class="short_description">Provides access to the ArangoDB server</p>
<div class="details">
<div class="long_description"><p>As all access is done using HTTP, we do not need to establish a
persistent connection and keep its state.<br>
Instead, connections are established on the fly for each request
and are destroyed afterwards.<br></p></div>
<table class="table table-bordered">
<tr>
<th>package</th>
<td><a href="../packages/ArangoDBClient.html">ArangoDBClient</a></td>
</tr>
<tr>
<th>since</th>
<td>0.2</td>
</tr>
</table>
<h3>
<i title="Methods" class="icon-custom icon-method"></i> Methods</h3>
<a id="method___construct"></a><div class="element clickable method public method___construct " data-toggle="collapse" data-target=".method___construct .collapse" title="public">
<h2>Set up the connection object, validate the options provided</h2>
<pre>__construct(array $options) </pre>
<div class="labels"></div>
<div class="row collapse"><div class="detail-description">
<div class="long_description"></div>
<h3>Parameters</h3>
<div class="subelement argument">
<h4>$options</h4>
<code>array</code><ul>
<li>initial connection options</li>
</ul></div>
<h3>Exceptions</h3>
<table class="table table-bordered"><tr>
<th><code>\ArangoDBClient\Exception</code></th>
<td></td>
</tr></table>
</div></div>
</div>
<a id="method___destruct"></a><div class="element clickable method public method___destruct " data-toggle="collapse" data-target=".method___destruct .collapse" title="public">
<h2>Close existing connection handle if a keep-alive connection was used</h2>
<pre>__destruct() : void</pre>
<div class="labels"></div>
<div class="row collapse"><div class="detail-description"><div class="long_description"></div></div></div>
</div>
<a id="method_check_encoding"></a><div class="element clickable method public method_check_encoding " data-toggle="collapse" data-target=".method_check_encoding .collapse" title="public">
<h2>This function checks that the encoding of the keys and
values of the array are utf-8, recursively.</h2>
<pre>check_encoding(array $data) </pre>
<div class="labels"><span class="label">Static</span></div>
<div class="row collapse"><div class="detail-description">
<div class="long_description"><p>It will raise an exception if it encounters wrong encoded strings.</p></div>
<h3>Parameters</h3>
<div class="subelement argument">
<h4>$data</h4>
<code>array</code><p>the data to check</p></div>
<h3>Exceptions</h3>
<table class="table table-bordered"><tr>
<th><code>\ArangoDBClient\ClientException</code></th>
<td></td>
</tr></table>
</div></div>
</div>
<a id="method_delete"></a><div class="element clickable method public method_delete " data-toggle="collapse" data-target=".method_delete .collapse" title="public">
<h2>Issue an HTTP DELETE request with the data provided</h2>
<pre>delete(string $url, array $customHeaders<code> = array()</code>, string $data<code> = ''</code>) : \ArangoDBClient\HttpResponse</pre>
<div class="labels"></div>
<div class="row collapse"><div class="detail-description">
<div class="long_description"></div>
<h3>Parameters</h3>
<div class="subelement argument">
<h4>$url</h4>
<code>string</code><ul>
<li>DELETE URL</li>
</ul></div>
<div class="subelement argument">
<h4>$customHeaders</h4>
<code>array</code>
</div>
<div class="subelement argument">
<h4>$data</h4>
<code>string</code><ul>
<li>delete body</li>
</ul></div>
<h3>Exceptions</h3>
<table class="table table-bordered"><tr>
<th><code>\ArangoDBClient\Exception</code></th>
<td></td>
</tr></table>
<h3>Returns</h3>
<div class="subelement response"><code>\ArangoDBClient\HttpResponse</code></div>
</div></div>
</div>
<a id="method_detect_utf"></a><div class="element clickable method public method_detect_utf " data-toggle="collapse" data-target=".method_detect_utf .collapse" title="public">
<h2>This function checks that the encoding of a string is utf.</h2>
<pre>detect_utf(array $string) : boolean</pre>
<div class="labels"><span class="label">Static</span></div>
<div class="row collapse"><div class="detail-description">
<div class="long_description"><p>It only checks for printable characters.</p></div>
<h3>Parameters</h3>
<div class="subelement argument">
<h4>$string</h4>
<code>array</code><p>the data to check</p></div>
<h3>Returns</h3>
<div class="subelement response">
<code>boolean</code>true if string is UTF-8, false if not</div>
</div></div>
</div>
<a id="method_get"></a><div class="element clickable method public method_get " data-toggle="collapse" data-target=".method_get .collapse" title="public">
<h2>Issue an HTTP GET request</h2>
<pre>get(string $url, array $customHeaders<code> = array()</code>) : \ArangoDBClient\HttpResponse</pre>
<div class="labels"></div>
<div class="row collapse"><div class="detail-description">
<div class="long_description"></div>
<h3>Parameters</h3>
<div class="subelement argument">
<h4>$url</h4>
<code>string</code><ul>
<li>GET URL</li>
</ul></div>
<div class="subelement argument">
<h4>$customHeaders</h4>
<code>array</code>
</div>
<h3>Exceptions</h3>
<table class="table table-bordered"><tr>
<th><code>\ArangoDBClient\Exception</code></th>
<td></td>
</tr></table>
<h3>Returns</h3>
<div class="subelement response"><code>\ArangoDBClient\HttpResponse</code></div>
</div></div>
</div>
<a id="method_getActiveBatch"></a><div class="element clickable method public method_getActiveBatch " data-toggle="collapse" data-target=".method_getActiveBatch .collapse" title="public">
<h2>returns the active batch</h2>
<pre>getActiveBatch() : \ArangoDBClient\Batch</pre>
<div class="labels"></div>
<div class="row collapse"><div class="detail-description">
<div class="long_description"></div>
<h3>Returns</h3>
<div class="subelement response">
<code>\ArangoDBClient\Batch</code>active batch</div>
</div></div>
</div>
<a id="method_getBatches"></a><div class="element clickable method public method_getBatches " data-toggle="collapse" data-target=".method_getBatches .collapse" title="public">
<h2>returns the active batch</h2>
<pre>getBatches() </pre>
<div class="labels"></div>
<div class="row collapse"><div class="detail-description"><div class="long_description"></div></div></div>
</div>
<a id="method_getCurrentEndpoint"></a><div class="element clickable method public method_getCurrentEndpoint " data-toggle="collapse" data-target=".method_getCurrentEndpoint .collapse" title="public">
<h2>Returns the current endpoint we are currently connected to
(or, if no connection has been established yet, the next endpoint
that we will connect to)</h2>
<pre>getCurrentEndpoint() : string</pre>
<div class="labels"></div>
<div class="row collapse"><div class="detail-description">
<div class="long_description"></div>
<h3>Returns</h3>
<div class="subelement response">
<code>string</code>- the current endpoint that we are connected to</div>
</div></div>
</div>
<a id="method_getDatabase"></a><div class="element clickable method public method_getDatabase " data-toggle="collapse" data-target=".method_getDatabase .collapse" title="public">
<h2>Get the database to use with this connection, for example: 'my_database'</h2>
<pre>getDatabase() : string</pre>
<div class="labels"></div>
<div class="row collapse"><div class="detail-description">
<div class="long_description"></div>
<h3>Returns</h3>
<div class="subelement response"><code>string</code></div>
</div></div>
</div>
<a id="method_getOption"></a><div class="element clickable method public method_getOption " data-toggle="collapse" data-target=".method_getOption .collapse" title="public">
<h2>Get an option set for the connection</h2>
<pre>getOption(string $name) : mixed</pre>
<div class="labels"></div>
<div class="row collapse"><div class="detail-description">
<div class="long_description"></div>
<h3>Parameters</h3>
<div class="subelement argument">
<h4>$name</h4>
<code>string</code><ul>
<li>name of option</li>
</ul></div>
<h3>Exceptions</h3>
<table class="table table-bordered"><tr>
<th><code>\ArangoDBClient\ClientException</code></th>
<td></td>
</tr></table>
<h3>Returns</h3>
<div class="subelement response"><code>mixed</code></div>
</div></div>
</div>
<a id="method_getOptions"></a><div class="element clickable method public method_getOptions " data-toggle="collapse" data-target=".method_getOptions .collapse" title="public">
<h2>Get the options set for the connection</h2>
<pre>getOptions() : \ArangoDBClient\ConnectionOptions</pre>
<div class="labels"></div>
<div class="row collapse"><div class="detail-description">
<div class="long_description"></div>
<h3>Returns</h3>
<div class="subelement response"><code>\ArangoDBClient\ConnectionOptions</code></div>
</div></div>
</div>
<a id="method_head"></a><div class="element clickable method public method_head " data-toggle="collapse" data-target=".method_head .collapse" title="public">
<h2>Issue an HTTP Head request with the data provided</h2>
<pre>head(string $url, array $customHeaders<code> = array()</code>) : \ArangoDBClient\HttpResponse</pre>
<div class="labels"></div>
<div class="row collapse"><div class="detail-description">
<div class="long_description"></div>
<h3>Parameters</h3>
<div class="subelement argument">
<h4>$url</h4>
<code>string</code><ul>
<li>PUT URL</li>
</ul></div>
<div class="subelement argument">
<h4>$customHeaders</h4>
<code>array</code>
</div>
<h3>Exceptions</h3>
<table class="table table-bordered"><tr>
<th><code>\ArangoDBClient\Exception</code></th>
<td></td>
</tr></table>
<h3>Returns</h3>
<div class="subelement response"><code>\ArangoDBClient\HttpResponse</code></div>
</div></div>
</div>
<a id="method_isInBatchCaptureMode"></a><div class="element clickable method public method_isInBatchCaptureMode " data-toggle="collapse" data-target=".method_isInBatchCaptureMode .collapse" title="public">
<h2>Returns true if this connection is in Batch-Capture mode</h2>
<pre>isInBatchCaptureMode() : boolean</pre>
<div class="labels"></div>
<div class="row collapse"><div class="detail-description">
<div class="long_description"></div>
<h3>Returns</h3>
<div class="subelement response"><code>boolean</code></div>
</div></div>
</div>
<a id="method_json_encode_wrapper"></a><div class="element clickable method public method_json_encode_wrapper " data-toggle="collapse" data-target=".method_json_encode_wrapper .collapse" title="public">
<h2>This is a json_encode() wrapper that also checks if the data is utf-8 conform.</h2>
<pre>json_encode_wrapper(mixed $data, mixed $options<code> = 0</code>) : string</pre>
<div class="labels"></div>
<div class="row collapse"><div class="detail-description">
<div class="long_description"><p>internally it calls the check_encoding() method. If that method does not throw
an Exception, this method will happily return the json_encoded data.</p></div>
<h3>Parameters</h3>
<div class="subelement argument">
<h4>$data</h4>
<code>mixed</code><p>the data to encode</p></div>
<div class="subelement argument">
<h4>$options</h4>
<code>mixed</code><p>the options for the json_encode() call</p></div>
<h3>Exceptions</h3>
<table class="table table-bordered"><tr>
<th><code>\ArangoDBClient\ClientException</code></th>
<td></td>
</tr></table>
<h3>Returns</h3>
<div class="subelement response">
<code>string</code>the result of the json_encode</div>
</div></div>
</div>
<a id="method_parseResponse"></a><div class="element clickable method public method_parseResponse " data-toggle="collapse" data-target=".method_parseResponse .collapse" title="public">
<h2>Parse the response return the body values as an assoc array</h2>
<pre>parseResponse(\ArangoDBClient\HttpResponse $response) : \ArangoDBClient\HttpResponse</pre>
<div class="labels"></div>
<div class="row collapse"><div class="detail-description">
<div class="long_description"></div>
<h3>Parameters</h3>
<div class="subelement argument">
<h4>$response</h4>
<code>\ArangoDBClient\HttpResponse</code><ul>
<li>the response as supplied by the server</li>
</ul></div>
<h3>Exceptions</h3>
<table class="table table-bordered"><tr>
<th><code>\ArangoDBClient\Exception</code></th>
<td></td>
</tr></table>
<h3>Returns</h3>
<div class="subelement response"><code>\ArangoDBClient\HttpResponse</code></div>
</div></div>
</div>
<a id="method_patch"></a><div class="element clickable method public method_patch " data-toggle="collapse" data-target=".method_patch .collapse" title="public">
<h2>Issue an HTTP PATCH request with the data provided</h2>
<pre>patch(string $url, string $data, array $customHeaders<code> = array()</code>) : \ArangoDBClient\HttpResponse</pre>
<div class="labels"></div>
<div class="row collapse"><div class="detail-description">
<div class="long_description"></div>
<h3>Parameters</h3>
<div class="subelement argument">
<h4>$url</h4>
<code>string</code><ul>
<li>PATCH URL</li>
</ul></div>
<div class="subelement argument">
<h4>$data</h4>
<code>string</code><ul>
<li>patch body</li>
</ul></div>
<div class="subelement argument">
<h4>$customHeaders</h4>
<code>array</code>
</div>
<h3>Exceptions</h3>
<table class="table table-bordered"><tr>
<th><code>\ArangoDBClient\Exception</code></th>
<td></td>
</tr></table>
<h3>Returns</h3>
<div class="subelement response"><code>\ArangoDBClient\HttpResponse</code></div>
</div></div>
</div>
<a id="method_post"></a><div class="element clickable method public method_post " data-toggle="collapse" data-target=".method_post .collapse" title="public">
<h2>Issue an HTTP POST request with the data provided</h2>
<pre>post(string $url, string $data, array $customHeaders<code> = array()</code>) : \ArangoDBClient\HttpResponse</pre>
<div class="labels"></div>
<div class="row collapse"><div class="detail-description">
<div class="long_description"></div>
<h3>Parameters</h3>
<div class="subelement argument">
<h4>$url</h4>
<code>string</code><ul>
<li>POST URL</li>
</ul></div>
<div class="subelement argument">
<h4>$data</h4>
<code>string</code><ul>
<li>body to post</li>
</ul></div>
<div class="subelement argument">
<h4>$customHeaders</h4>
<code>array</code>
</div>
<h3>Exceptions</h3>
<table class="table table-bordered"><tr>
<th><code>\ArangoDBClient\Exception</code></th>
<td></td>
</tr></table>
<h3>Returns</h3>
<div class="subelement response"><code>\ArangoDBClient\HttpResponse</code></div>
</div></div>
</div>
<a id="method_put"></a><div class="element clickable method public method_put " data-toggle="collapse" data-target=".method_put .collapse" title="public">
<h2>Issue an HTTP PUT request with the data provided</h2>
<pre>put(string $url, string $data, array $customHeaders<code> = array()</code>) : \ArangoDBClient\HttpResponse</pre>
<div class="labels"></div>
<div class="row collapse"><div class="detail-description">
<div class="long_description"></div>
<h3>Parameters</h3>
<div class="subelement argument">
<h4>$url</h4>
<code>string</code><ul>
<li>PUT URL</li>
</ul></div>
<div class="subelement argument">
<h4>$data</h4>
<code>string</code><ul>
<li>body to post</li>
</ul></div>
<div class="subelement argument">
<h4>$customHeaders</h4>
<code>array</code>
</div>
<h3>Exceptions</h3>
<table class="table table-bordered"><tr>
<th><code>\ArangoDBClient\Exception</code></th>
<td></td>
</tr></table>
<h3>Returns</h3>
<div class="subelement response"><code>\ArangoDBClient\HttpResponse</code></div>
</div></div>
</div>
<a id="method_setActiveBatch"></a><div class="element clickable method public method_setActiveBatch " data-toggle="collapse" data-target=".method_setActiveBatch .collapse" title="public">
<h2>Sets the active Batch for this connection</h2>
<pre>setActiveBatch(\ArangoDBClient\Batch $batch) : \ArangoDBClient\Batch</pre>
<div class="labels"></div>
<div class="row collapse"><div class="detail-description">
<div class="long_description"></div>
<h3>Parameters</h3>
<div class="subelement argument">
<h4>$batch</h4>
<code>\ArangoDBClient\Batch</code><ul>
<li>Sets the given batch as active</li>
</ul></div>
<h3>Returns</h3>
<div class="subelement response">
<code>\ArangoDBClient\Batch</code>active batch</div>
</div></div>
</div>
<a id="method_setBatchRequest"></a><div class="element clickable method public method_setBatchRequest " data-toggle="collapse" data-target=".method_setBatchRequest .collapse" title="public">
<h2>Sets connection into Batch-request mode. This is needed for some operations to act differently when in this mode.</h2>
<pre>setBatchRequest(boolean $state) </pre>
<div class="labels"></div>
<div class="row collapse"><div class="detail-description">
<div class="long_description"></div>
<h3>Parameters</h3>
<div class="subelement argument">
<h4>$state</h4>
<code>boolean</code><p>sets the connection state to batch request, meaning it is currently doing a batch request.</p></div>
</div></div>
</div>
<a id="method_setCaptureBatch"></a><div class="element clickable method public method_setCaptureBatch " data-toggle="collapse" data-target=".method_setCaptureBatch .collapse" title="public">
<h2>Sets the batch capture state (true, if capturing)</h2>
<pre>setCaptureBatch(boolean $state) </pre>
<div class="labels"></div>
<div class="row collapse"><div class="detail-description">
<div class="long_description"></div>
<h3>Parameters</h3>
<div class="subelement argument">
<h4>$state</h4>
<code>boolean</code><p>true to turn on capture batch mode, false to turn it off</p></div>
</div></div>
</div>
<a id="method_setDatabase"></a><div class="element clickable method public method_setDatabase " data-toggle="collapse" data-target=".method_setDatabase .collapse" title="public">
<h2>Set the database to use with this connection</h2>
<pre>setDatabase(string $database) </pre>
<div class="labels"></div>
<div class="row collapse"><div class="detail-description">
<div class="long_description"><p>Sets the database to use with this connection, for example: 'my_database'<br>
Further calls to the database will be addressed to the given database.</p></div>
<h3>Parameters</h3>
<div class="subelement argument">
<h4>$database</h4>
<code>string</code><p>the database to use</p></div>
</div></div>
</div>
<a id="method_setOption"></a><div class="element clickable method public method_setOption " data-toggle="collapse" data-target=".method_setOption .collapse" title="public">
<h2>Set an option set for the connection</h2>
<pre>setOption(string $name, string $value) </pre>
<div class="labels"></div>
<div class="row collapse"><div class="detail-description">
<div class="long_description"></div>
<h3>Parameters</h3>
<div class="subelement argument">
<h4>$name</h4>
<code>string</code><ul>
<li>name of option</li>
</ul></div>
<div class="subelement argument">
<h4>$value</h4>
<code>string</code><ul>
<li>value of option</li>
</ul></div>
<h3>Exceptions</h3>
<table class="table table-bordered"><tr>
<th><code>\ArangoDBClient\ClientException</code></th>
<td></td>
</tr></table>
</div></div>
</div>
<a id="method_stopCaptureBatch"></a><div class="element clickable method public method_stopCaptureBatch " data-toggle="collapse" data-target=".method_stopCaptureBatch .collapse" title="public">
<h2>Stop capturing commands</h2>
<pre>stopCaptureBatch() : \ArangoDBClient\Batch</pre>
<div class="labels"></div>
<div class="row collapse"><div class="detail-description">
<div class="long_description"></div>
<h3>Returns</h3>
<div class="subelement response">
<code>\ArangoDBClient\Batch</code>- Returns the active batch object</div>
</div></div>
</div>
<a id="method_test"></a><div class="element clickable method public method_test " data-toggle="collapse" data-target=".method_test .collapse" title="public">
<h2>Test if a connection can be made using the specified connection options,
i.e. endpoint (host/port), username, password</h2>
<pre>test() : boolean</pre>
<div class="labels"></div>
<div class="row collapse"><div class="detail-description">
<div class="long_description"></div>
<h3>Returns</h3>
<div class="subelement response">
<code>boolean</code>- true if the connection succeeds, false if not</div>
</div></div>
</div>
<a id="method_closeHandle"></a><div class="element clickable method private method_closeHandle " data-toggle="collapse" data-target=".method_closeHandle .collapse" title="private">
<h2>Close an existing connection handle</h2>
<pre>closeHandle() : void</pre>
<div class="labels"></div>
<div class="row collapse"><div class="detail-description"><div class="long_description"></div></div></div>
</div>
<a id="method_doBatch"></a><div class="element clickable method private method_doBatch " data-toggle="collapse" data-target=".method_doBatch .collapse" title="private">
<h2>This is a helper function to executeRequest that captures requests if we're in batch mode</h2>
<pre>doBatch(mixed $method, string $request) : mixed</pre>
<div class="labels"></div>
<div class="row collapse"><div class="detail-description">
<div class="long_description"></div>
<h3>Parameters</h3>
<div class="subelement argument">
<h4>$method</h4>
<code>mixed</code><ul>
<li>The method of the request (GET, POST...)</li>
</ul></div>
<div class="subelement argument">
<h4>$request</h4>
<code>string</code><ul>
<li>The request to process</li>
</ul>
<p>This checks if we're in batch mode and returns a placeholder object,
since we need to return some object that is expected by the caller.
if we're not in batch mode it does not return anything, and</p></div>
<h3>Exceptions</h3>
<table class="table table-bordered"><tr>
<th><code>\ArangoDBClient\ClientException</code></th>
<td></td>
</tr></table>
<h3>Returns</h3>
<div class="subelement response">
<code>mixed</code>Batchpart or null if not in batch capturing mode</div>
</div></div>
</div>
<a id="method_executeRequest"></a><div class="element clickable method private method_executeRequest " data-toggle="collapse" data-target=".method_executeRequest .collapse" title="private">
<h2>Execute an HTTP request and return the results</h2>
<pre>executeRequest(string $method, string $url, string $data, array $customHeaders<code> = array()</code>) : \ArangoDBClient\HttpResponse</pre>
<div class="labels"></div>
<div class="row collapse"><div class="detail-description">
<div class="long_description"><p>This function will throw if no connection to the server can be established or if
there is a problem during data exchange with the server.</p>
<p>will restore it.</p></div>
<h3>Parameters</h3>
<div class="subelement argument">
<h4>$method</h4>
<code>string</code><ul>
<li>HTTP request method</li>
</ul></div>
<div class="subelement argument">
<h4>$url</h4>
<code>string</code><ul>
<li>HTTP URL</li>
</ul></div>
<div class="subelement argument">
<h4>$data</h4>
<code>string</code><ul>
<li>data to post in body</li>
</ul></div>
<div class="subelement argument">
<h4>$customHeaders</h4>
<code>array</code><ul>
<li>any array containing header elements</li>
</ul></div>
<h3>Exceptions</h3>
<table class="table table-bordered"><tr>
<th><code>\ArangoDBClient\Exception</code></th>
<td></td>
</tr></table>
<h3>Returns</h3>
<div class="subelement response"><code>\ArangoDBClient\HttpResponse</code></div>
</div></div>
</div>
<a id="method_getHandle"></a><div class="element clickable method private method_getHandle " data-toggle="collapse" data-target=".method_getHandle .collapse" title="private">
<h2>Get a connection handle</h2>
<pre>getHandle() : resource</pre>
<div class="labels"></div>
<div class="row collapse"><div class="detail-description">
<div class="long_description"><p>If keep-alive connections are used, the handle will be stored and re-used</p></div>
<h3>Exceptions</h3>
<table class="table table-bordered">
<tr>
<th><code>\ArangoDBClient\ClientException</code></th>
<td></td>
</tr>
<tr>
<th><code>\ArangoDBClient\ConnectException</code></th>
<td></td>
</tr>
</table>
<h3>Returns</h3>
<div class="subelement response">
<code>resource</code>- connection handle</div>
</div></div>
</div>
<a id="method_handleFailover"></a><div class="element clickable method private method_handleFailover " data-toggle="collapse" data-target=".method_handleFailover .collapse" title="private">
<h2>Execute the specified callback, and try again if it fails because
the target server is not available. In this case, try again with failing
over to an alternative server (the new leader) until the maximum number
of failover attempts have been made</h2>
<pre>handleFailover(mixed $cb) : \ArangoDBClient\HttpResponse</pre>
<div class="labels"></div>
<div class="row collapse"><div class="detail-description">
<div class="long_description"></div>
<h3>Parameters</h3>
<div class="subelement argument">
<h4>$cb</h4>
<code>mixed</code><ul>
<li>the callback function to execute</li>
</ul></div>
<h3>Exceptions</h3>
<table class="table table-bordered"><tr>
<th><code>\ArangoDBClient\Exception</code></th>
<td>- either a ConnectException or a FailoverException or an
                    Exception produced by the callback function</td>
</tr></table>
<h3>Returns</h3>
<div class="subelement response"><code>\ArangoDBClient\HttpResponse</code></div>
</div></div>
</div>
<a id="method_notify"></a><div class="element clickable method private method_notify " data-toggle="collapse" data-target=".method_notify .collapse" title="private">
<h2>Calls the notification callback function to inform to make the
client application aware of some failure so it can do something
appropriate (e.g. logging)</h2>
<pre>notify($message) : void</pre>
<div class="labels"></div>
<div class="row collapse"><div class="detail-description">
<div class="long_description"></div>
<h3>Parameters</h3>
<div class="subelement argument"><h4>$message</h4></div>
</div></div>
</div>
<a id="method_updateHttpHeader"></a><div class="element clickable method private method_updateHttpHeader " data-toggle="collapse" data-target=".method_updateHttpHeader .collapse" title="private">
<h2>Recalculate the static HTTP header string used for all HTTP requests in this connection</h2>
<pre>updateHttpHeader() </pre>
<div class="labels"></div>
<div class="row collapse"><div class="detail-description"><div class="long_description"></div></div></div>
</div>
<h3>
<i title="Properties" class="icon-custom icon-property"></i> Properties</h3>
<a id="property__activeBatch"> </a><div class="element clickable property private property__activeBatch" data-toggle="collapse" data-target=".property__activeBatch .collapse" title="private">
<h2>$_activeBatch object</h2>
<pre>$_activeBatch : \ArangoDBClient\Batch</pre>
<div class="row collapse"><div class="detail-description">
<h3>Default</h3>
<div class="subelement argument"></div>
</div></div>
<div class="labels"></div>
<div class="row collapse"><div class="detail-description"><div class="long_description"></div></div></div>
</div>
<a id="property__baseUrl"> </a><div class="element clickable property private property__baseUrl" data-toggle="collapse" data-target=".property__baseUrl .collapse" title="private">
<h2>Pre-assembled base URL for the current database
This is pre-calculated when connection options are set/changed, to avoid
calculation of the same base URL in each request done via the
connection</h2>
<pre>$_baseUrl : string</pre>
<div class="row collapse"><div class="detail-description">
<h3>Default</h3>
<div class="subelement argument"><code>''</code></div>
</div></div>
<div class="labels"></div>
<div class="row collapse"><div class="detail-description"><div class="long_description"></div></div></div>
</div>
<a id="property__batchRequest"> </a><div class="element clickable property private property__batchRequest" data-toggle="collapse" data-target=".property__batchRequest .collapse" title="private">
<h2>$_batchRequest boolean</h2>
<pre>$_batchRequest : boolean</pre>
<div class="row collapse"><div class="detail-description">
<h3>Default</h3>
<div class="subelement argument"><code>false</code></div>
</div></div>
<div class="labels"></div>
<div class="row collapse"><div class="detail-description"><div class="long_description"></div></div></div>
</div>
<a id="property__batches"> </a><div class="element clickable property private property__batches" data-toggle="collapse" data-target=".property__batches .collapse" title="private">
<h2>Batches Array</h2>
<pre>$_batches : array</pre>
<div class="row collapse"><div class="detail-description">
<h3>Default</h3>
<div class="subelement argument"><code>array()</code></div>
</div></div>
<div class="labels"></div>
<div class="row collapse"><div class="detail-description"><div class="long_description"></div></div></div>
</div>
<a id="property__captureBatch"> </a><div class="element clickable property private property__captureBatch" data-toggle="collapse" data-target=".property__captureBatch .collapse" title="private">
<h2>$_captureBatch boolean</h2>
<pre>$_captureBatch : boolean</pre>
<div class="row collapse"><div class="detail-description">
<h3>Default</h3>
<div class="subelement argument"><code>false</code></div>
</div></div>
<div class="labels"></div>
<div class="row collapse"><div class="detail-description"><div class="long_description"></div></div></div>
</div>
<a id="property__database"> </a><div class="element clickable property private property__database" data-toggle="collapse" data-target=".property__database .collapse" title="private">
<h2>$_database string</h2>
<pre>$_database : string</pre>
<div class="row collapse"><div class="detail-description">
<h3>Default</h3>
<div class="subelement argument"><code>''</code></div>
</div></div>
<div class="labels"></div>
<div class="row collapse"><div class="detail-description"><div class="long_description"></div></div></div>
</div>
<a id="property__handle"> </a><div class="element clickable property private property__handle" data-toggle="collapse" data-target=".property__handle .collapse" title="private">
<h2>Connection handle, used in case of keep-alive</h2>
<pre>$_handle : resource</pre>
<div class="row collapse"><div class="detail-description">
<h3>Default</h3>
<div class="subelement argument"></div>
</div></div>
<div class="labels"></div>
<div class="row collapse"><div class="detail-description"><div class="long_description"></div></div></div>
</div>
<a id="property__httpHeader"> </a><div class="element clickable property private property__httpHeader" data-toggle="collapse" data-target=".property__httpHeader .collapse" title="private">
<h2>Pre-assembled HTTP headers string for connection
This is pre-calculated when connection options are set/changed, to avoid
calculation of the same HTTP header values in each request done via the
connection</h2>
<pre>$_httpHeader : string</pre>
<div class="row collapse"><div class="detail-description">
<h3>Default</h3>
<div class="subelement argument"><code>''</code></div>
</div></div>
<div class="labels"></div>
<div class="row collapse"><div class="detail-description"><div class="long_description"></div></div></div>
</div>
<a id="property__options"> </a><div class="element clickable property private property__options" data-toggle="collapse" data-target=".property__options .collapse" title="private">
<h2>Connection options</h2>
<pre>$_options : array</pre>
<div class="row collapse"><div class="detail-description">
<h3>Default</h3>
<div class="subelement argument"></div>
</div></div>
<div class="labels"></div>
<div class="row collapse"><div class="detail-description"><div class="long_description"></div></div></div>
</div>
<a id="property__useKeepAlive"> </a><div class="element clickable property private property__useKeepAlive" data-toggle="collapse" data-target=".property__useKeepAlive .collapse" title="private">
<h2>Flag if keep-alive connections are used</h2>
<pre>$_useKeepAlive : boolean</pre>
<div class="row collapse"><div class="detail-description">
<h3>Default</h3>
<div class="subelement argument"></div>
</div></div>
<div class="labels"></div>
<div class="row collapse"><div class="detail-description"><div class="long_description"></div></div></div>
</div>
</div>
</div>
</div>
</div>
<div class="row"><footer class="span12">
            Template is built using <a href="http://twitter.github.com/bootstrap/">Twitter Bootstrap 2</a> and icons provided by <a href="http://glyphicons.com/">Glyphicons</a>.<br>
            Documentation is powered by <a href="http://www.phpdoc.org/">phpDocumentor 2.9.0</a> and<br>
            generated on 2019-08-19T13:30:48+02:00.<br></footer></div>
</div>
</body>
</html>
